package com.lichuang.dedao.user.enums;

import lombok.Getter;

@Getter
public enum Gender {
    /**
     * 未知
     */
    UNKNOWN(0, "未知"),

    /**
     * 男
     */
    MALE(1, "男"),

    /**
     * 女
     */
    FEMAIL(2, "女");

    private final Integer value;

    private final String name;

    Gender(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static Gender genderOf(Integer value) {
        for (int i = 0; i < Gender.values().length; i++) {
            if (Gender.values()[i].value == value) {
                return Gender.values()[i];
            }
        }
        return UNKNOWN;
    }

}
